{extend name="public/base"}
{block name='main'}
<!--编辑菜单-->
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
    <input type="hidden" name="pid" />
    <input type="hidden" name="id" value="{$info.id|default=''}" />
    <div class="layui-form-item">
        <label class="layui-form-label">上级分类</label>
        <div class="layui-input-block">
            <select name="pid">
                <option value="0">顶级分类</option>
                {volist name="menulist" id="val" }
                <option value="{$val.id|default=''}" {eq name="info.pid|default=''" value="$val.id"}selected="selected"{/eq} >{$val.name|default=''}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">菜单名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" id="name" lay-verify="name" value="{$info.name|default=''}" placeholder="请输入" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">module</label>
        <div class="layui-input-block">
            <input type="text" name="module_name" id="module_name" lay-verify="required" value="{$info.module_name|default=''}" placeholder="请输入" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">action</label>
        <div class="layui-input-block">
            <input type="text" name="action_name" id="action_name" lay-verify="" value="{$info.action_name|default=''}" placeholder="请输入" class="layui-input" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">data</label>
        <div class="layui-input-block">
            <input type="text" name="data" id="data" lay-verify="" value="{$info.data|default=''}" placeholder="请输入" class="layui-input" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">ico</label>
        <div class="layui-input-block">
            <input type="text" name="ico" id="ico" lay-verify="ico" placeholder="请输入" class="layui-input" value="{$info.ico|default='xe602'}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input type="number" name="ordid" id="ordid" lay-verify="ordid" placeholder="请输入" class="layui-input" value="{$info.ordid|default='0'}">
        </div>
    </div>
    <div class="layui-form-item"  pane="">
        <label class="layui-form-label">位置</label>
        <div class="layui-input-block">
            <input type="radio" title="左侧菜单" name="style" value="left" {eq name="info.style|default='left'" value="left"}checked="checked"{/eq}>
            <input type="radio" title="顶部菜单" name="style" value="top" {eq name="info.style|default=''" value="top"}checked="checked"{/eq}>
        </div>
    </div>
    <div class="layui-form-item"  pane="">
        <label class="layui-form-label">是否启用</label>
        <div class="layui-input-block">
            <input type="radio" title="是" name="status" value="1" {eq name="info.status|default='1'" value="1"}checked="checked"{/eq}>
            <input type="radio" title="否" name="status" value="0" {eq name="info.status|default=''" value="0"}checked="checked"{/eq}>
        </div>
    </div>
    <div class="layui-form-item">
        <label class=""></label>
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="content_edit">提交保存</button>
        </div>
    </div>
</form>

<script type="text/javascript" src="__PUBLIC__/admin/layui/layui.js"></script>
<script>
    layui.use(['layer','jquery','form','element'], function () {
        // 操作对象
        var layer = layui.layer,$ = layui.jquery,form = layui.form, element = layui.element;
        //验证表单
        form.verify({
            name: function(value, item){ //value：表单的值、item：表单的DOM对象
                if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
                    return '不能有特殊字符';
                }
                if(/(^\_)|(\__)|(\_+$)/.test(value)){
                    return '首尾不能出现下划线\'_\'';
                }
                if(/^\d+\d+\d$/.test(value)){
                    return '不能全为数字';
                }
            }

        });
        // 提交
        Oper.initUpdate(layui, '文档分类', 'content_edit', 'doc_cate/edit');
    });
</script>

{/block}